package com.qiall.boot.fileservice.data.config;

import com.qiall.boot.fileservice.data.properties.MinioProperties;
import io.minio.MinioClient;
import io.minio.errors.InvalidEndpointException;
import io.minio.errors.InvalidPortException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Configuration
@Component
public class FileServiceConfig {
    @Autowired
    private MinioProperties properties;

    @Bean
    public MinioClient minioClient() throws InvalidPortException, InvalidEndpointException {
        MinioClient client = new MinioClient(properties.getEndPoint(), properties.getAccessKey(), properties.getSecretKey());
          return client;
    }
}
